﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using VIP;
using VIP.Extension;
using VIP.Manager;

/// <summary>
/// 解密
/// </summary>
public class DecryptExample : MonoBehaviour {

    public InputField inputField;
    public Button btn;
    public Button clearBtn;
    public Button copyBtn;
    public AudioClip clip;


    void Start () {
        btn.onClick.AddListener(() =>
        {
            if (inputField.text.IsNotEmpty())
            {
                inputField.text = inputField.text.DES().MD5();
            }
            else {
                VIPToast.Instance.Show("请输入机器码");
            }
        });
        clearBtn.onClick.AddListener(() =>
        {
            inputField.text = "";
        });
        copyBtn.onClick.AddListener(() =>
        {
            if (inputField.text.IsNotEmpty()) {
                VIPFileUtil.Copy(inputField.text);
                VIPToast.Instance.Show("已复制到剪切板");
            }
            else
            {
                VIPToast.Instance.Show("请输入机器码");
            }
        });
        VIPAudio.Instance.Play(clip, true);
    }
	
}
